#pragma once

#include "camera_video_enc.h"
#include "base_callback_list.h"
#include <string>

namespace El {
namespace Hal {

class CameraVideoEnc : public ICameraVideoEnc {
public:
    CameraVideoEnc(uint32_t channel, uint32_t stream);
    ~CameraVideoEnc() = default;

    /// 开始编码。
    int32_t Start(PacketCallback cb) override;

    /// 停止编码，
    void Stop(int32_t handle) override;

    /// 强制编码器产生I帧。
    bool ForceIFrame() override;

    /// 抓图
    bool Snapshot() override;

    /// 获取编码格式
    bool GetEncFormat(VideoEncFormat &enc) override;

    /// 设置OSD
    void SetOSD(bool enable) override;

    /// 视频流回调
    void OnStream(VideoEncPacket &packet);

private:
    bool start_{false};

    Base::CallbackList<void, VideoEncPacket> cb_list_;
    uint32_t channel_;
    uint32_t stream_;

    static bool init_;
};

} // namespace Hal
} // namespace El
